// ---------------------------------------------------------------------
//
// -- 游戏基类包
// -- author £
//
// ---------------------------------------------------------------------

const //CommonInfo = require('CommonInfo'),
    CommonUtil = require('CommonUtil'),
    superClass = require('singlebase').BaseSingleMediator,
    modelSuper = require('singlebase').BaseSingleModel;

let game_single_base = {
    //游戏中介层基类
    GameSingleMediator: cc.Class({
        name: "GameSingleMediator",
        extends: superClass,
        properties: {
            textureKey: ''
        },

        initCtor: function () {
            CommonUtil.mysuper(superClass, this, 'initCtor');
            this._scheduler = new (require('common').MyScheduler)();
        },

        clearData: function () {
            CommonUtil.mysuper(superClass, this, 'clearData');
            this._scheduler.unscheduleAllCallbacks();
            require('TextureManager').releaseGame();
        },

        resetData: function () {

        },

        onRegister: function (v) {
            CommonUtil.mysuper(superClass, this, 'onRegister', v);
        },

        onRelease: function () {
            CommonUtil.mysuper(superClass, this, 'onRelease');
            // CommonInfo.clearData();
            // require('TextureManager').release(this.textureKey);
            // this._scheduler.unscheduleAllCallbacks();
            // this._scheduler = null;
            // this._responseQueue.length = 0;
            // this._responseQueue = null;
            // this.model = null;
            // this.gameProtocol.clearData();
            // this.gameProtocol = null;
        },


        //-----------------------------------------------------------


        configData: function () {

        },

        /** 获取游戏状态 */
        gameState: function () {
            return this.model.gameState;
        },

        /** 显示总结算 */
        showTotalResult: function () {
        },

        //-----------------------------------------------------------

        //服务器回调 -----------------------------------------------------------

        showReturnHandler: function () {
            this.scene.showReturnPanel(
                this._curScore,
                require('CommonInfo').dayBestScore
            );
        },

    }),


    /** --------------------游戏模型基类--------------------------------------- */
    
    GameSingleModel: cc.Class({
        extends: modelSuper,
        name: "GameSingleModel",
        properties: {
        },

        // clearData: function () {
        //     CommonUtil.mysuper(modelSuper, this, 'clearData');
        // },

        // resetData: function () {
        //     CommonUtil.mysuper(modelSuper, this, 'resetData');
            
        // },


    }),
};

module.exports = game_single_base;